<!DOCTYPE html>
<html>
<head>
<title></title> <@h.head />


<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}

tr {
	cursor: pointer;
}
</style>
</head>
<body>
	<div class="definewidth">
		<@shiro.hasPermission name="sys:perm:add"> <a class="btn btn-success"
			href="${path}/resources/add">新增菜单</a> </@shiro.hasPermission>
	</div>
	<table class="table table-bordered table-hover definewidth m10">
		<thead>
			<tr>
				<th>菜单标题</th>
				<th>菜单类型</th>
				<th>描述</th>
				<th>菜单编码</th>
				<th>url</th>
				<th>是否启用</th>
				<th>操作</th>
			</tr>
		</thead>
		<#list list as u> <#if u.pid==0>
		<tr pid="${u.pid}" ids="${u.id}">
			<td colspan="6">${(u.name)!""}</td>
			<td><@shiro.hasPermission name="sys:perm:update"> <a
				class="edit" href="${path}/resources/add?id=${(u.id)!0}">修改</a>
				</@shiro.hasPermission>
			</td>
		</tr>
		</#if> <#list list as r> <#if r.pid==u.id && r.type==0>
		<tr pid="${r.pid}" ids="${r.id}">
			<td style="padding-left: 30px;">${(r.name)!""}</td>
			<td>${(r.type==0)?string('菜单','按钮')}</td>
			<td>${(r.description)!""}</td>
			<td>${(r.permission)!""}</td>
			<td>${(r.url)!""}</td>
			<td>${(r.disabled==0)?string('启用','禁用')}</td>
			<td><@shiro.hasPermission name="sys:perm:update"> <a
				class="edit" href="${path}/resources/add?id=${(r.id)!0}">修改</a>
				</@shiro.hasPermission>
			</td>
		</tr>
		<#list list as rr> <#if rr.pid==r.id >
		<tr pid="${rr.pid}" ids="${rr.id}" rid="${u.id}">
			<td style="padding-left: 50px;">${(rr.name)!""}</td>
			<td>${(rr.type==0)?string('菜单','按钮')}</td>
			<td>${(rr.description)!""}</td>
			<td>${(rr.permission)!""}</td>
			<td>${(rr.url)!""}</td>
			<td>${(rr.disabled==0)?string('启用','禁用')}</td>
			<td><@shiro.hasPermission name="sys:perm:update"> <a
				class="edit" href="${path}/resources/add?id=${(rr.id)!0}">修改</a>
				</@shiro.hasPermission>
			</td>
		</tr>
		</#if> </#list> </#if> </#list> </#list>
	</table>
	<@h.foot />
	<script type="text/javascript">
		$("[pid]").click(function() {
			var pid = $(this).attr("pid");
			var ids = $(this).attr("ids");
			var flag = $(this).attr("flag");
			if (flag == 1) {
				$(this).removeAttr("flag");
				$("[pid='" + ids + "']").show().removeAttr("flag");
				$("[rid='" + ids + "']").show();
			} else {
				$(this).attr("flag", "1");
				$("[pid='" + ids + "']").hide().attr("flag", "1");
				$("[rid='" + ids + "']").hide();
			}
		});
	</script>
</body>
</html>
